Java Development for Mobile Phones

Part 2

 

A. Exploring the High-level UI API

 

You can find a description of the Java ME UI API under the javax.microedition.lcdui package at http://java.sun.com/javame/reference/apis/jsr118/.

 

Task 1

 

The aim of this task is to explore various elements of the high-level UI API. For this purpose you should build an application that utilises a number of screens. Your application should navigate between the different screens on the basis of Commands and user input. The application should also include some logic that changes its navigation behaviour between screens, e.g. new screens are created, different flows are followed, etc.

 

In addition to the above, in the case of Forms you must experiment with the various Items that they may include by setting them up in various configurations, retrieving and changing their values etc. Besides utilising command listeners for the navigation you should also explore, item command listeners and item state listeners.

 

It may be helpful to consider some application functionality that is driven by the UI you are developing. For example, you could try to develop Forms with various TextFields that allow users to add/remove TextFileds, convert some of them into fixed StringItems, etc. You can also experiment with Lists, again with variable Items where users can add/remove Items. Or, you can explore Forms with ChoiceGroups where users can add/remove choice items, etc.

 

Mobile Device Interface Design

 

In Guidelines for handheld Mobile Device Interface Design J. Gong and P. Tarasewich show how the typical guidelines for UI design need to be adapted for a mobile device context.

 

Task 2

 

Taking the above guidelines into consideration assess the quality of the UI that you developed for Task 1.

 

Adjust the UI of Task 1 to address any weakness you identify.

 

B. Exploring the Record Management System (RMS)

 

You can find a description of the Java ME RMS under the javax.microedition.rms package at http://java.sun.com/javame/reference/apis/jsr118/. The description of the package includes sample code of how a particular RMS store can be constructed and used. Note that as RMS stores data in byte array form you will also need to look at the java.io package in particular the input and output streams that allow writing and reading of various data types into and out of byte arrays. You may also find useful to look at RMS.pdf.

 

A tricky aspect of RMS stores is that elements are indentified with Ids. These Ids start from 1 and are incremented every time a new element is added to the store. However, when elements are removed from a store the Ids are not reused and as a result leave gaps in the sequence of valid Ids. As a result, you need to keep somehow track of the mapping between store Ids and the elements behind them. Something like a Hashtable may be useful for this. Note however the lack of generics in Java ME.

 

Task 1

 

The aim of this task is to develop a Java ME application with a simple user registration system.

 

The application starts with a Screen that asks users to authenticate themselves by providing a users name and PIN (a four digit number) that they have previously registered with the system. The start up Screen also presents users with the option to register, if they have not previously done so, and to quit the program.

 

When a user provides a correct user name and PIN, the system goes to a Screen that shows a welcome message which includes the user’s name (provided during registration). The Screen also allows users to exit, which brings them back to the start up Screen. In the case of incorrect authentication information the system shows a warning Screen with an appropriate message and returns to the start up Screen.

 

The registration Screen asks users to provide their full name, which will be used in the welcome message, and their user name and PIN, which will be required for authentication. The registration Screen also allows users to go back to the start up screen to authenticate.

 

The application uses an RMS record store to store user registration details and to ensure that new users do not try to register a user name that has previously been used.

 

Task 2

 

The aim of this task is to develop an application with complex UI behaviour like the ones you developed in Task 2 of part A and combine them with an RMS store. The store will keep information about the various items making their construction persistent from run to run. It is essential that the store is kept in sync with any changes carried out through the UI.